# $Id$
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: mathieui <mathieui@mathieui.net>
# Contributor: jiribb <jiribb@gmail.com>

pkgname=ldns
pkgver=1.7.0
pkgrel=3
pkgdesc='Fast DNS library supporting recent RFCs'
url='https://www.nlnetlabs.nl/projects/ldns/'
license=('custom:BSD')
arch=('i686' 'x86_64')
depends=('openssl' 'dnssec-anchors')
optdepends=('libpcap: ldns-dpa tool')
makedepends=('libpcap')
source=("https://www.nlnetlabs.nl/downloads/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        'pc.patch')
sha256sums=('c19f5b1b4fb374cfe34f4845ea11b1e0551ddc67803bd6ddd5d2a20f0997a6cc'
            '3586302eed28269c7fa6013785c0a017689aa9d4ff24ff8d7735fa23a3732cb7')

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	patch -p1 -i ../pc.patch
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--disable-rpath \
		--with-drill \
		--with-examples \
		--with-trust-anchor=/etc/trusted-key.key \
		--disable-dane-verify # needs openssl>=1.1.0

	make
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" install
	install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
